<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>once 修饰符</title>
</head>
<body>
<div id="app">
    <form action="https://www.baidu.com/s" method="get">
        <input type="text" name="wd">
        <input type="submit" value="百度一下">
        <input type="submit" value="百度一下" @click="onsubmit">
        <!--  prevent 作用：阻止默认事件行为  -->
        <!--  input sumbit 的作用：用于将所有用户值提交到表单处理程序  -->
        <input type="submit" value="百度一下" @click.prevent="onsubmit">
        <!--  once 修饰符的作用：只执行一次  -->
        <input type="submit" value="百度一下" @click.prevent.once="onsubmit">

    </form>


    <button @click="btnClicked">点击</button>
    <button @click.once="btnClicked">点击</button>
</div>
<script type="module">
    import {createApp} from "../../../../../js/vue.esm-browser.js";

    const app = createApp({
        setup() {
            function onsubmit() {
                console.log("调用了 onsubmit 函数");
            }

            function btnClicked() {
                console.log("点击了按钮");
            }

            return {
                onsubmit,
                btnClicked,
            }
        }
    })

    app.mount("#app")
</script>
</body>
</html>